package solutions;

public class Euler010 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int[] sieve = new int[2000000];
		long result = 0;
		for(int pos = 2; pos < 2000000; pos++){
			if(sieve[pos] == 0) result += pos;
			for(int j = 2*pos; j < sieve.length; j = j + pos){
				sieve[j] = -1;
			}
		}
		System.out.println("Answer: " + result);
		
	}

}
